package com.yc.cloud.cloudindex.rpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;
import java.net.InetSocketAddress;

public class RpcClient {
    public static void main(String[] args) throws IOException {
        //构建代理对象
        ClientProtocol proxy=(ClientProtocol) RPC.getProxy(
                ClientProtocol.class,1L,
                new InetSocketAddress("127.0.0.1",2345),
                new Configuration());
        final int result=proxy.add(3,5);
        String r=proxy.echo(result+"");
        System.out.println(r);
    }
}
